<template>
  <view class="orderStatus">
    <div class="head">
      <div class="navBar">
        <van-icon name="arrow-left" custom-class="backIcon" @tap="onClickLeft"/>
        <span>订单详情</span>
      </div>

      <div class="state" v-if="state==0">
        <div class="title">
          <img src="@/static/icon/cg.png">
          交易成功
        </div>
        <div class="describe">购物愉快</div>
        <div class="btn">
          <span>
            <navigator url="logistics" hover-class="none">查看物流</navigator>
          </span>
        </div>
      </div>

      <div class="state" v-if="state==1">
        <div class="title">
          <img src="@/static/icon/d.png">
          待付款
        </div>
        <div class="describe">剩 12 天 13 小时自动关闭订单</div>
        <div class="btn">
          <span>
            <navigator url="../../details/payment" hover-class="none">去付款</navigator>
          </span>
        </div>
      </div>

      <div class="state" v-if="state==2">
        <div class="title">
          <img src="@/static/icon/cg.png">
          买家已付款
        </div>
        <div class="describe">请耐心等待发货</div>
        <div class="btn">
          <span @tap="remind">提醒发货</span>
        </div>
      </div>

      <div class="state" v-if="state==3">
        <div class="title">
          <img src="@/static/icon/d.png">
          商家已发货
        </div>
        <div class="describe">剩 12 天 13 小时自动确认收货</div>
        <div class="btn">
          <span>
            <navigator url="order?active=4" hover-class="none">确认收货</navigator>
          </span>
        </div>
      </div>
    </div>

    <div class="address">
      <img src="@/static/icon/dz.png" class="dz">
      <h2>
        <span>收货人：小明</span>
        <span>12345678901</span>
      </h2>
      <div class="txt">
        <van-icon name="arrow"/>广东省深圳市南山区软件园一期1栋3楼广东省深圳市南山区软件园一期1栋3楼
      </div>
    </div>

    <div class="line"></div>

    <div class="logistics" v-if="state==3">
      <navigator url="logistics" hover-class="none">
        <div class="logisticsM">
          <img src="@/static/icon/car.png" class="car">
          <span>[深圳市]快件已经到达 深圳南山</span>
          <p>018-12-01 0.00</p>
          <van-icon name="arrow"/>
        </div>
      </navigator>
      <div class="line"></div>
    </div>

    <div class="orderBox">
      <div class="title">
        <h2>
          多多官方旗舰店
          <van-icon name="arrow"/>
        </h2>
      </div>
      <div class="cplist">
        <div class="img">
          <img src="~@/static/home/pic(1).png">
        </div>
        <div class="info">
          <h2>强生婴儿牛奶沐浴露1L*2儿童宝宝洗澡液沐浴乳新生洗护滋润家庭装</h2>
          <div class="desc">
            <span>颜色分类：咖色</span>
            <span>x2</span>
          </div>
          <div class="jifen">
            积分
            <span>49.90</span>
          </div>
        </div>
        <div class="btn">
          <button type="primary">取消订单</button>
        </div>

        <div class="statistics">
          <div>
            <span>积分</span>
            <span>0</span>
          </div>
          <div>
            <span>配额积分</span>
            <span>0</span>
          </div>
          <div>
            <span>运费（快递费）</span>
            <span>0元</span>
          </div>
          <div>
            <span>订单总价</span>
            <span>积分 49.90</span>
          </div>
          <div>
            <span></span>
            <span>
              已付款：
              <b>
                <em>积分</em>
                <i>49.90</i>
              </b>
            </span>
          </div>
        </div>
      </div>
    </div>
    <div class="line"></div>

    <div class="order">
      <p>订单编号：NNH20181201000001</p>
      <p>创建时间：2018-12-01</p>
      <p>付款时间：2018-12-01</p>
    </div>

    <van-toast id="van-toast"/>
  </view>
</template>

<script>
import Toast from "@/wxcomponents/vant/dist/toast/toast";
export default {
  data() {
    return {
      state: 0
    };
  },
  onLoad(option) {
    this.state = option.state;
  },
  methods: {
    onClickLeft() {
      uni.navigateBack();
    },
    remind() {
      Toast.success("成功文案");
    }
  }
};
</script>

<style lang="less">
.head {
  background: #f5db5f;
  width: 100%;
  text-align: center;
  padding-bottom: 60upx;
  .navBar {
    width: 100%;
    display: inline-block;
    padding: 80upx 20upx 0;
    text-align: center;
    position: relative;
    text-align: center;
    span {
      color: #000;
      font-size: 36upx;
    }
    .backIcon {
      color: #000 !important;
      font-size: 40upx !important;
      vertical-align: middle;
      float: left;
      left: 0;
      padding-left: 20upx;
      bottom: 0;
      padding-top: 17upx;
      padding-right: 10upx;
      position: absolute;
    }
  }

  .state {
    margin-top: 65upx;
    color: #3c1e0d;
    .title {
      font-size: 30upx;
      font-weight: bold;
      img {
        width: 31upx;
        height: 31upx;
        vertical-align: middle;
        margin-right: 15upx;
      }
    }
    .describe {
      font-size: 26upx;
      line-height: 80upx;
    }
    .btn {
      span {
        border-radius: 54upx;
        width: 126upx;
        height: 54upx;
        color: #3c1e0d;
        font-size: 26upx;
        line-height: 54upx;
        display: inline-block;
        background: #fff;
      }
    }
  }
}

.address {
  background: #fff;
  border-radius: 32upx 32upx 0 0;
  width: 100%;
  margin-top: -20upx;
  padding: 50upx 30upx 30upx 90upx;
  box-sizing: border-box;
  position: relative;
  .dz {
    width: 29upx;
    height: 37upx;
    position: absolute;
    left: 30upx;
    top: 50%;
    transform: translate(0, -30%);
  }

  h2 {
    width: 100%;
    display: flex;
    justify-content: space-between;
    color: #333;
    font-size: 30upx;
    padding-bottom: 28upx;
  }
  .txt {
    width: 570upx;
    color: #999;
    font-size: 26upx;
    position: relative;
    van-icon {
      position: absolute;
      right: -30upx;
      top: 50%;
      transform: translate(0, -50%);
      color: #999;
    }
  }
}

.orderBox {
  width: 100%;
  display: inline-block;
  background: #fff;

  .title {
    height: 84upx;
    line-height: 84upx;
    border-bottom: 1upx solid #e0e0e0;
    h2 {
      float: left;
      padding-left: 30upx;
      font-size: 26upx;
      color: #000;
      .van-icon {
        vertical-align: middle;
        color: #999;
      }
    }
    span {
      float: right;
      padding-right: 28upx;
      color: #ff242e;
      font-size: 26upx;
    }
  }
  .cplist {
    margin-top: 28upx;
    width: 100%;
    display: inline-block;
    .img {
      float: left;
      width: 196upx;
      text-align: center;
      img {
        width: 105upx;
        height: 105upx;
      }
    }
  }

  .info {
    float: left;
    width: 520upx;
    h2 {
      line-height: 32upx;
      font-size: 26upx;
      color: #000;
    }
    .desc {
      color: #999;
      font-size: 20upx;
      margin-top: 14upx;
      display: flex;
      justify-content: space-between;
    }
    .jifen {
      color: #333;
      font-size: 20upx;
      span {
        margin-left: 5upx;
        font-size: 24upx;
      }
    }
  }
  .heji {
    width: 100%;
    text-align: right;
    margin-top: 35upx;
    font-size: 24upx;
    color: #333;
    display: inline-block;
    padding-right: 20upx;
    box-sizing: border-box;
    span {
      font-size: 20upx;
    }
  }
  .btn {
    width: 100%;
    text-align: right;
    margin-top: 29upx;
    display: inline-block;
    padding-right: 15upx;
    box-sizing: border-box;
    button {
      width: 154upx;
      height: 62upx;
      border-radius: 10upx;
      background: #fff;
      border: 1upx solid #999;
      font-size: 24upx;
      color: #616161;
      display: inline-block;
      margin-left: 20upx;
      padding: 0;
      &.red {
        border: 1upx solid #ff242e;
        color: #ff242e;
      }
    }
  }

  .statistics {
    width: 100%;
    padding: 30upx;
    div {
      display: flex;
      justify-content: space-between;
      color: #616161;
      font-size: 26upx;
      span:nth-child(2) {
        color: #333;
        b {
          display: inline-block;
        }
        em {
          display: inline-block;
          font-size: 20upx;
        }
        i {
          font-size: 30upx;
          display: inline-block;
          margin-left: 10upx;
        }
      }
    }
  }
}

.order {
  padding: 30upx;
  line-height: 50upx;
  color: #333;
  font-size: 26upx;
}

.logisticsM {
  height: 100upx;
  position: relative;
  padding: 20upx 30upx 20upx 90upx;
  .car {
    position: absolute;
    width: 44upx;
    height: 36upx;
    left: 30upx;
    top: 50%;
    transform: translate(0, -50%);
  }
  span {
    font-size: 26upx;
    color: #14b144;
  }
  p {
    font-size: 22upx;
    color: #999;
  }
  van-icon {
    position: absolute;
    right: 30upx;
    top: 50%;
    transform: translate(0, -50%);
    color: #999;
  }
}
</style>
